package com.liang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liang.entity.CCommentId;
import com.liang.mapper.CCommentIdMapper;
import com.liang.service.CCommentIdService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 李昂
 * @since 2021-01-30
 */
@Service
public class CCommentIdServiceImpl extends ServiceImpl<CCommentIdMapper, CCommentId> implements CCommentIdService {

    @Override
    public boolean InsertCommentId(CCommentId commentId) {
        return this.save(commentId);
    }

    @Override
    public List<CCommentId> getCommentId(Integer bid) {
        return this.baseMapper.getCommentId(bid);
    }

    @Override
    public boolean deleteComment(String cid) {
        LambdaQueryWrapper<CCommentId> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(CCommentId::getCid2, cid);
        return this.remove(lambdaQueryWrapper);
    }

    @Override
    public boolean deleteCommentid(String cid) {
        LambdaQueryWrapper<CCommentId> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(CCommentId::getCid1, cid);
        return this.remove(lambdaQueryWrapper);
    }


}
